package cn.wolfcode.crm.service.impl;

import cn.wolfcode.crm.domain.PaymentResult;
import cn.wolfcode.crm.mapper.PaymentResultMapper;
import cn.wolfcode.crm.query.PageResult;
import cn.wolfcode.crm.query.PaymentResultQueryObject;
import cn.wolfcode.crm.service.IPaymentResultService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PaymentResultServiceImpl implements IPaymentResultService {

    @Autowired
    private PaymentResultMapper paymentResultMapper;
    public int deleteByPrimaryKey(Long id) {
        return paymentResultMapper.deleteByPrimaryKey(id);
    }

    public int insert(PaymentResult record) {
        return paymentResultMapper.insert(record);
    }

    public PaymentResult selectByPrimaryKey(Long id) {
        return paymentResultMapper.selectByPrimaryKey(id);
    }

    public List<PaymentResult> selectAll() {
        return paymentResultMapper.selectAll();
    }

    public int updateByPrimaryKey(PaymentResult record) {
        return paymentResultMapper.updateByPrimaryKey(record);
    }

    public PageResult query(PaymentResultQueryObject qo) {
        int total = paymentResultMapper.queryForCount(qo);
        System.out.println(total);
        if (total==0){
            return new PageResult();
        }
        List<PaymentResult> rows = paymentResultMapper.queryForList(qo);

        return new PageResult(rows,total);
    }


}
